package org.liaohailong.victorlibrary.ui.slide;

import android.os.Bundle;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager2.adapter.FragmentStateAdapter;
import androidx.viewpager2.widget.ViewPager2;

import org.liaohailong.victorlibrary.R;
import org.liaohailong.victorlibrary.base.BaseActivity;

/**
 * create by liaohailong
 * time 2023/3/7 19:48
 * desc: 左滑显示菜单功能
 */
public class SlideLeftActivity extends BaseActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_slide_left);

        ViewPager2 listView = findViewById(R.id.list_view);

        FragmentStateAdapter adapter = new FragmentStateAdapter(this) {
            @NonNull
            @Override
            public Fragment createFragment(int position) {
                return new SlideFragment(position);
            }

            @Override
            public int getItemCount() {
                return 2;
            }
        };
        listView.setAdapter(adapter);
    }
}
